package kr.hkit.powerjava.chapter23;

public class Consumer implements Runnable{
	private Buffer buffer;

	public Consumer(Buffer buffer) {
		this.buffer = buffer;
	}
	
	@Override
	public void run() {
		for (int i = 0; i < 15; i++) {
			int data = buffer.get();
			System.out.println("소비자 : " + i + "번 케익을 구입을 하여 먹었습니다.");
			try {
				Thread.sleep((int)(Math.random() * 100));
			} catch (InterruptedException e) {}
		}
	}
}